package com.company.behavioral.observer_pattern.client;

import com.company.behavioral.observer_pattern.concrete_observer.Player;
import com.company.behavioral.observer_pattern.concrete_subject.ConcreteAllyControlCenter;
import com.company.behavioral.observer_pattern.observer.Observer;
import com.company.behavioral.observer_pattern.subject.AllyControlCenter;

/**
 * @ClassName Client
 * @Author tiezheng.han
 * @Date 2020/9/7 11:06
 **/
public class Client {
    public static void main(String[] args) {
        // 定义观察者目标
        AllyControlCenter acc;
        acc = new ConcreteAllyControlCenter("MIS战队");

        // 定义4个观察者对象
        Observer player1,player2,player3,player4,player5;

        player1 = new Player("韩伟");
        acc.join(player1);
        player2 = new Player("吴迪");
        acc.join(player2);
        player3 = new Player("黄小琴");
        acc.join(player3);
        player4 = new Player("宋少强");
        acc.join(player4);
        player5 = new Player("徐家文");
        acc.join(player5);
        // 某成员遭受攻击
        player5.beAttacked(acc);
    }
}
